from fastapi import APIRouter
from pydantic import BaseModel
from finance.python.services import register_services


register_router = APIRouter(
    prefix="/api",
    tags=["register"]
)


class RegisterRequest(BaseModel):
    username: str
    password: str
    phone: str
    verifyCode: str


@register_router.post(path='/register', summary="注册")
async def register(register_data: RegisterRequest):
    """
    注册
    :param register_data: 注册请求数据
    :return: 注册结果
    """
    return await register_services.register(
        register_data.username,
        register_data.password,
        register_data.phone,
        register_data.verifyCode
    )
